package com.ihg.hiex.entity.session.during;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.EnumType;
import javax.persistence.Enumerated;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

/**
 * 
 * @author dan
 *
 */
@Entity
@Table(name = "session_calibration_recommendation")
public class SessionCalibrationRecommendation {
    
    @Id
    @GeneratedValue
    private Long id;
    
    /** 是否简单酒店 */
    private Boolean simpleHotel;
    
    /** 简单酒店所需时间 */
    @Enumerated(EnumType.STRING)
    private SessionCalibrationResultType simpleHotelResult;
    
    /** 是否普通酒店 */
    private Boolean averageHotel;
    
    /** 普通酒店所需时间 */
    @Enumerated(EnumType.STRING)
    private SessionCalibrationResultType averageHotelResult;
    
    /** 是否复杂酒店 */
    private Boolean complexHotel;
    
    /** 普通复杂所需时间 */
    @Enumerated(EnumType.STRING)
    private SessionCalibrationResultType complexHotelResult;
    
    /** comments */
    private String comment;
    
    @ManyToOne(fetch = FetchType.LAZY, optional = false)
    private SessionCalibration sessionCalibration;
    
    /** 状态 */
    @Enumerated(EnumType.STRING)
    private SessionCalibrationStatus status;
    
    @Column(name = "is_disabled")
    private boolean disabled;
    
    /**
     * The default constructor
     */
    public SessionCalibrationRecommendation() {
        
    }
    
    /**
     * 
     * @param sessionCalibration
     */
    public SessionCalibrationRecommendation(SessionCalibration sessionCalibration) {
        this.sessionCalibration = sessionCalibration;
        this.status = SessionCalibrationStatus.EDITING;
        this.disabled = false;
    }
    
    /**
     * 
     * @param sessionCalibration
     * @return
     */
    public SessionCalibrationRecommendation initilization(SessionCalibration sessionCalibration) {
//        this.simpleHotel = this.simpleHotel == null ? false : this.simpleHotel;
//        this.simpleHotelResult = this.simpleHotel ? this.simpleHotelResult : null;
//        this.averageHotel = this.averageHotel == null ? false : this.averageHotel;
//        this.averageHotelResult = this.averageHotel ? this.averageHotelResult : null;
//        this.complexHotel = this.complexHotel == null ? false : this.complexHotel;
//        this.complexHotelResult = this.complexHotel ? this.complexHotelResult : null;
        this.sessionCalibration = sessionCalibration;
        this.status = SessionCalibrationStatus.EDITING;
        this.disabled = false;
        return this;
    }
    
    /**
     * 
     * @param recommendation
     * @return
     */
    public SessionCalibrationRecommendation edit(SessionCalibrationRecommendation recommendation) {
//        this.simpleHotel = recommendation.getSimpleHotel() == null ? false : recommendation.getSimpleHotel();
        this.simpleHotelResult = recommendation.getSimpleHotelResult();
//        this.averageHotel = recommendation.getAverageHotel() == null ? false : recommendation.getAverageHotel();
//        this.averageHotelResult = this.averageHotel ? recommendation.averageHotelResult : null;
//        this.complexHotel = recommendation.getComplexHotel() == null ? false : recommendation.getComplexHotel();
//        this.complexHotelResult = this.complexHotel ? recommendation.getComplexHotelResult() : null;
        this.comment = recommendation.getComment();
        return this;
    }

    /**
     * @return the id
     */
    public Long getId() {
        return id;
    }

    /**
     * @return the simpleHotel
     */
    public Boolean getSimpleHotel() {
        return simpleHotel;
    }

    /**
     * @return the simpleHotelResult
     */
    public SessionCalibrationResultType getSimpleHotelResult() {
        return simpleHotelResult;
    }

    /**
     * @return the averageHotel
     */
    public Boolean getAverageHotel() {
        return averageHotel;
    }

    /**
     * @return the averageHotelResult
     */
    public SessionCalibrationResultType getAverageHotelResult() {
        return averageHotelResult;
    }

    /**
     * @return the complexHotel
     */
    public Boolean getComplexHotel() {
        return complexHotel;
    }

    /**
     * @return the complexHotelResult
     */
    public SessionCalibrationResultType getComplexHotelResult() {
        return complexHotelResult;
    }

    /**
     * @return the comment
     */
    public String getComment() {
        return comment;
    }

    /**
     * @return the sessionCalibration
     */
    public SessionCalibration getSessionCalibration() {
        return sessionCalibration;
    }

    /**
     * @return the status
     */
    public SessionCalibrationStatus getStatus() {
        return status;
    }

    /**
     * @return the disabled
     */
    public boolean isDisabled() {
        return disabled;
    }

    /**
     * @param id the id to set
     */
    public void setId(Long id) {
        this.id = id;
    }

    /**
     * @param simpleHotel the simpleHotel to set
     */
    public void setSimpleHotel(Boolean simpleHotel) {
        this.simpleHotel = simpleHotel;
    }

    /**
     * @param simpleHotelResult the simpleHotelResult to set
     */
    public void setSimpleHotelResult(SessionCalibrationResultType simpleHotelResult) {
        this.simpleHotelResult = simpleHotelResult;
    }

    /**
     * @param averageHotel the averageHotel to set
     */
    public void setAverageHotel(Boolean averageHotel) {
        this.averageHotel = averageHotel;
    }

    /**
     * @param averageHotelResult the averageHotelResult to set
     */
    public void setAverageHotelResult(SessionCalibrationResultType averageHotelResult) {
        this.averageHotelResult = averageHotelResult;
    }

    /**
     * @param complexHotel the complexHotel to set
     */
    public void setComplexHotel(Boolean complexHotel) {
        this.complexHotel = complexHotel;
    }

    /**
     * @param complexHotelResult the complexHotelResult to set
     */
    public void setComplexHotelResult(SessionCalibrationResultType complexHotelResult) {
        this.complexHotelResult = complexHotelResult;
    }

    /**
     * @param comment the comment to set
     */
    public void setComment(String comment) {
        this.comment = comment;
    }

    /**
     * @param sessionCalibration the sessionCalibration to set
     */
    public void setSessionCalibration(SessionCalibration sessionCalibration) {
        this.sessionCalibration = sessionCalibration;
    }

    /**
     * @param status the status to set
     */
    public void setStatus(SessionCalibrationStatus status) {
        this.status = status;
    }

    /**
     * @param disabled the disabled to set
     */
    public void setDisabled(boolean disabled) {
        this.disabled = disabled;
    }

}
